package com.etc.service.impl;

import com.etc.dao.FavoriteDao;
import com.etc.dao.FocusDao;
import com.etc.entity.Concern;
import com.etc.entity.Favorite;
import com.etc.entity.History;
import com.etc.service.FocusService;
import com.etc.service.favoriteService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 *
 * @author makejava
 * @since 2021-10-18 21:07:18
 */
@Service
public class favoriteServiceImpl implements favoriteService {

    @Autowired
    FavoriteDao dao;

    @Override
    public boolean addfavorite(String userId, String videoId) {
        return dao.favoriteById(userId,videoId)>0;
    }

    @Override
    public boolean deletefavoriteById(String userId, String videoId) {
        return dao.deleteFavoriteById(userId,videoId)>0;
    }

    @Override
    public boolean queryfavoriteByUserIdAndRoomId(String userId, String videoId) {
        return dao.queryFavoriteByUserIdAndRoomId(userId,videoId)!=null;
    }

    @Override
    public List<Favorite> queryFavoriteByUserIdAndVideoId(String userId) {
        return dao.queryFavoriteByUserIdAndVideoId(userId);
    }
}
